<?php

declare(strict_types=1);

namespace app\shop\controller\admin;

use think\Request;
use think\Response;
use think\facade\Db;
use sheep\controller\Backend;
use sheep\exception\SheepException;
use app\shop\model\Feedback as FeedbackModel;
use sheep\controller\traits\Crud;

class Feedback extends Backend
{
    use Crud;
    protected $model = null;
    protected $isPaginate = true;
    protected $onlyParams = ['status', 'remark'];

    public function initialize()
    {
        $this->model = new FeedbackModel();
    }

    /**
     * 查看
     *
     * @return Response
     */
    public function list(Request $request): Response
    {
        $list = $this->model->sheepFilter()->with('user')->paginate($request->param('list_rows', 10));

        return success('获取成功', $list);
    }

    /**
     * 详情
     *
     * @param  $id
     * @return \think\Response
     */
    public function detail($id)
    {
        $detail = $this->model->with('user')->findOrFail($id);
        return success('获取成功', $detail);
    }
}
